local nya__luoshen = fk.CreateSkill {

  name = "nya__luoshen",

  tags = { Skill.Compulsory, },

}



nya__luoshen:addEffect(fk.EventPhaseStart, {
  name = "nya__luoshen",
  anim_type = "drawcard",
  events = {fk.EventPhaseStart},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(nya__luoshen.name) and
      (player.phase == Player.Start or (player.phase == Player.Finish and not player:hasSkill("nya__play", true)))
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    while true do
      local judge = {
        who = player,
        reason = nya__luoshen.name,
        pattern = ".|.|spade,club",
      }
      room:judge(judge)
      if judge.card.color ~= Card.Black or not room:askForSkillInvoke(player, nya__luoshen.name) then
        break
      end
    end
  end,
})

nya__luoshen:addEffect(fk.FinishJudge, {
  name = "#nya__luoshen_obtain",
  mute = true,
  frequency = Skill.Compulsory,
  events = {fk.FinishJudge},
  can_trigger = function(self, event, target, player, data)
    return target == player and not player.dead and data.reason == "nya__luoshen" and
    player.room:getCardArea(data.card) == Card.Processing
  end,
  on_use = function(self, event, target, player, data)
    player.room:obtainCard(player, data.card)
  end,
})

return nya__luoshen